package org.huhu.mercury.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
/**
 * Hello world!
 *
 */
@Configuration
@ComponentScan //表示可以直接返回对象
@EnableAutoConfiguration
@ServletComponentScan
@ImportResource(locations={"classpath:META-INF/spring/mercury-web-integration.xml"})
public class App {
	public static Logger logger=LoggerFactory.getLogger(App.class);
	public static void main(String[] args) throws Exception {
		String strProfile=System.getProperty("spring.profiles.active");
		if(strProfile==null||"".equals(strProfile.trim())){
			System.setProperty("spring.profiles.active", "dev");
		}
		ApplicationContext ctx=SpringApplication.run(App.class, args);
		String[] activeProfiles = ctx.getEnvironment().getActiveProfiles();
		for (String profile : activeProfiles) {
			logger.warn("Spring Boot 使用profile为:{}" , profile);
		}
	}
}